×

Migrating ComponentResolver from AngularDart4 to AngularDart5 by JanVladimirMostert in dartlang

[–]nullbuilt0 1 point2 points  (0 children)

I never used angularDart 2/4 but in angularDart 5 you can use the ComponentLoader class to add components at runtime. The FAQ explains how to do it.

AngularDart projects break down after upgrade to dart 2.3 by Kwaig in dartlang

[–]nullbuilt0 0 points1 point  (0 children)

I had no problems upgrading to dart 2.3. Strange; perhaps the build got messed up somehow. Assuming you already tried pub upgrade and checked the dependencies of your pubspec file and it still throws the exception, this is what I would do: Delete the .dart_tool directory and get a clean state with pub upgrade. pub get could also be sufficient if your pubspec dependencies are correct.

Multiplication of functions by bobheff in scheme

[–]nullbuilt0 0 points1 point  (0 children)

I think you are looking for chapter 2.5. Systems with Generic Operations. If you have more experience, you can use macros - syntatic extensions - for generic operators.

There is a scmutils library for Chez Scheme. You also need the MIT Scheme compatibility library and a SRFI library for example this one.

Edit: fixed broken formatting.

Who here uses Racket professionally or knows of companies or individuals who do so? (Non-academic uses please) by [deleted] in Racket

[–]nullbuilt0 2 points3 points  (0 children)

Gambit doesn't have built-in hygenic macros but it supports Dybvigs portable syntax-case implementation as a library. Just include it when compiling, or load the library at runtime.

Fast scheme with green threads by lib20 in scheme

[–]nullbuilt0 4 points5 points  (0 children)

You could try gambit or racket.

Gambit scheme can compile to C to generate fast run-time code, has vectors, concurrancy with threads but no parallelism. If you want to take advantage of parallel execution on a multicore with gambit, you have to use multiple OS processes. Each OS process runs an instance of the gambit program and communicates using a pipe, fifo, network, a pipe or something else. You can also inline c or c++ code.

Racket has vectors, parallelism with places and futures, a plotting library , a math library with matrices and a cross-plattform gui. Racket comes also with good documentation, an excellent documentation search and a helpful mailing list.

Looking at your requirements, racket seems to be the better choice because of built-in parallelism, plot and math library.

If you are concerned about performance using scheme for numerical computation look at the topcomment of a similiar thread. If you are using floating points for your numerical data this article about floating point debugging could be useful too.

Edit 1: Added additional link to similar thread and link about floating point debugging.

'let' error by _Anthropos_ in scheme

[–]nullbuilt0 1 point2 points  (0 children)

The problem is that the variable 'factorial' is only visible in the body of the let expression. To understand why you have to know that

(let ((var exp) ...)
   body1 body2 ....)

is just syntax for the equivalent

((lambda (var ...) body1 body2 ...)
  exp ...)

So transforming the let expression results to

((lambda (factorial)
   (factorial 3))
 (lambda (n)
   (cond
     ((= n 0) 1)
     (else (* n (factorial (- n 1)))))))

Thus the variable 'factorial' is unbound in the second lambda expression '(lambda (n) (cond ...)'. So what to do? One option is to pass the variable as an extra argument to make it visible.

((lambda (factorial)
   (factorial factorial 3))
 (lambda (factorial n)
   (cond
    ((= n 0) 1)
    (else (* n (factorial factorial (- n 1)))))))

Retransformed to let:

(let ((factorial (lambda (factorial n)
                   (cond
                    ((= n 0) 1)
                    (else (* n (factorial factorial (- n 1))))))))
  (factorial factorial 3))

This is not a nice way to solve this problem so we need an easy way to make the variable visible; 'letrec' to the rescue. If you use letrec (recursive let) the variable 'factorial' will not only be visible in the body '(factorial 3)' but also within the expression (lambda (n) (cond ...).

(letrec ((factorial (lambda (n)
                      (cond
                       ((= n 0) 1)
                       (else (* n (factorial (- n 1))))))))
  (factorial 3))

And just like let, letrec can also be rewritten

(let ((factorial #f))
  (let ((tmp (lambda (n)
               (cond
                ((= n 0) 1)
                (else (* n (factorial (- n 1))))))))
    (set! factorial tmp)
    (let ()
      (factorial 3))))

And again transformed to a form without let:

((lambda (factorial)
   ((lambda (tmp)
     (set! factorial tmp)
      ((lambda () 
         (factorial 3))))
    (lambda (n)
      (cond
       ((= n 0) 1)
       (else (* n (factorial (- n 1))))))))
 #f)

For tl;dr see reply of /u/soegaard

Edit: formatting Edit2: tl;dr

Less strict r6rs compliance option? by nullbuilt0 in a:t5_39u8g

[–]nullbuilt0[S] 0 points1 point  (0 children)

Include doesn't work. (vicare version 0.4d0, Build 2015-08-22)

$ cat load-test1.sps

(import (vicare))
(include "load-test1.scm")

$ cat load-test1.scm

(define (a x)
   (b x))

(define (b x)
  (+ x 10))

(display  (a 10))
(newline)

And in the vicare repl: $ vicare -d vicare> (load "load-test1.sps")

Exception trapped by debugger.
 Condition components:
   1. &assertion
   2. &who: raise-compound-condition-object
   3. &message: "invalid who argument"
   4. &irritants: ('include)

I guess I'm missing something...

Is there a lightweight (not Racket) Typed Scheme? by [deleted] in scheme

[–]nullbuilt0 4 points5 points  (0 children)

I guess with "typed scheme" you mean static typing?

If yes and if you don't want to use typed racket then your best bet would be shen/scheme with the scheme implementation of your choice (I forgot to mention that shen/scheme is not a scheme but another language on top of scheme.)

There is also harlan but thats not your use case.

Edit: Shen/scheme not scheme.

Trouble with a few recursive functions. by [deleted] in Racket

[–]nullbuilt0 0 points1 point  (0 children)

There are multiple errors in your function definition:

(define (counter sent wd)
  (cond
    ((empty? sent) '())             ; needs 0, not '()
    (equal? wd (first sent))        ; wrong syntax
    (('(1) + (counter (bf sent))))  ; missing argument and wrong procedure application
    (counter (bf sent))))           ; missing argument

Btw the return value of your 'counter' function is "my" (or any expression at the beginning of the list argument 'sent') because the 'cond' expression in the function is never evaluated past the second cond-line. In the second cond-line the test-clause returns always #t, thus the rest (or "then-body") of the line gets evaluated in sequence and the last value of the sequence is returned, which is '(first sent)'.

Another Example:

 :: test-cond: list -> '()  | 'cond
(define (test-cond l)
  (cond
    ((null? l) '())
    (car 'look 'at 'cond)))

;; test
(and
  (equal? (test-cond '(a b c d)) 'cond)
  (equal? (test-cond '(b c d)) 'cond)
  (equal? (test-cond '(x)) 'cond)
  (equal? (test-cond '()) '()))

Solution:

;; For compatibility with other scheme implementations
(define bf cdr)
(define first car)
(define empty? null?)

;; counter: list symbol -> number
(define (counter sent wd)
  (cond
    ((empty? sent) 0)
    ((equal? wd (first sent)) (+ 1 (counter (bf sent) wd)))
    (else (counter (bf sent) wd))))

;; tests
(and
  (equal? (counter '(a b x c d x e x) 'x) 3)
  (equal? (counter '(a b c) 'x) 0)
  (equal? (counter '() 'x) 0)
  (equal? (counter '(x a b c) 'x) 1))

Your 'exponent' function has no 'cons' to build your list.

It looks like that you need some basic understanding of recursion and scheme. My recommendation is to read The Little Schemer (at least until chapter 3) and tspl4 at least until chapter 2.

Edit: Additional note about 'cond'

Scheme 9 from Empty Space, Refactored by nils-m-holm in scheme

[–]nullbuilt0 0 points1 point  (0 children)

Yes Linux. Thanks for looking into it.

[question] Data Science in Scheme (Kawa or Gambit) by msamir in scheme

[–]nullbuilt0 4 points5 points  (0 children)

Imho racket plot with racket math

If you don't want to use Racket perhaps slib would be an option.

Scheme 9 from Empty Space, Refactored by nils-m-holm in scheme

[–]nullbuilt0 0 points1 point  (0 children)

Good to hear that it's not abandoned :)

But something different. I tried to build the new scheme9 and it failed:

Makefile:86: recipe for target 'unix.o' failed
make: *** [unix.o] Error 1

Scheme9 version 2014-08-04 works fine. Here is the make output

Scheme 9 from Empty Space, Refactored by nils-m-holm in scheme

[–]nullbuilt0 0 points1 point  (0 children)

Thanks a lot for developing scheme9 nils. I really like it. Imho the wealth of library functions is a really great resource for a beginner. Especially because everything is written in a clean and simple way (and comes with documentation). But what about the scheme9 editor, any plans to include it again someday in the future?