Code Monkey home page Code Monkey logo

dollar's People

Contributors

adispring avatar alsotang avatar ankurp avatar apiyron avatar bastos avatar binarydennis avatar bored0ne avatar futantan avatar gabrielghe avatar gitter-badger avatar gjeck avatar harlanhaskins avatar ikesyo avatar inamiy avatar jeanbernard avatar kartikshah avatar kaunteya avatar mattfaluotico avatar nubbel avatar pnre avatar posixpascal avatar rgkobashi avatar salbertson avatar simonyangme avatar solomon23 avatar tbondwilkinson avatar thelarkinn avatar tptee avatar tsheaff avatar zolrath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dollar's Issues

Some bugs in Cent

For Array extension: As per docs, I would expect

let unFlattened = ["foo", ["bar"], [["spam"]], [[["eggs"]]] ]
let flattened = unFlattened.flatten() 
=> ["foo", "bar", "spam", "eggs"]

But instead I obtain

let flattened = unFlattened.flatten() 
=> ["foo", {{}}, {{}}, __NSArray]

For Dictionary extension, I would expect:

var dic = ["foo": "bar"]
var another = ["foo": "baz"]
dic.merge(another)
=> ["foo": "baz"]

Instead I get an execution failed.
trace:

playground execution failed: error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x9).
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
* thread #1: tid = 0x208d2c, 0x000000010a707d39 libswift_stdlib_core.dylib`_swift_retain_(swift::HeapObject*) + 9, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x9)
  * frame #0: 0x000000010a707d39 libswift_stdlib_core.dylib`_swift_retain_(swift::HeapObject*) + 9
    frame #1: 0x000000010d656672

No need for $.

You do not need to use $. or make your functions part of a class. I agree in the functional win here, but consider making it special to swift.

Thoughts on taking collection as last parameter?

I think one of the things that Underscore got wrong was having the collection be the first parameter. Why? Currying a function becomes way less useful. If the collection was the last parameter, you could create curried functions that preload your logic, and all you need to do is pass it the data.

Thoughts?

String Trim

I would love to see a short function for .stringByTrimmingCharactersInSet(.whitespaceAndNewlineCharacterSet()) in Cent

Regular expression support

Just curious if you would consider adding helpers for NSRegularExpression. Apple's regex library is good, but it's a painful API to use and maintain. Otherwise, loving the library you've built!

Add memoize function

Swift compiler is still buggy even in Beta 2 of Xcode. I have am implementation that I will submit when the compiler is improved as it gets stuck in infinite loop and hogs all of the memory along with SourceKit.

forEach on Array

Are there plans to support forEach(map without return value) on Array for Dollar and Cent?

Command /bin/sh failed with exit code 1

@ankurp my project fails to compile because you are referencing a local file in gen_auto_curry.rb.

.../Dollar.swift/Dollar/gen_auto_curry.rb:24:in `initialize': No such file or directory - /Users/ankur/Personal/Dollar.swift/Dollar/Dollar/AutoCurry.swift (Errno::ENOENT)

My observation

$.difference removes duplicates

The current implementation of $.difference removes duplicate elements from the source array which is unexpected behavior.

We should add the following test and make sure it passes:

XCTAssertEqualObjects($.difference([1, 1], []), [1, 1], "Difference of arrays")

shuffle strange random behavior

When you shuffle an Array for ex: $.shuffle([1,2,3,4,5,6])
It never returns the first item in first array position and last item in last position too.
You can't return for ex: [1,5,3,4,2,6]

Compilation Failing

Xcode is hanging on Compiling source files when I try to run the test suite on master.

I isolated the issue to the line

XCTAssertEqualObjects(first([1, 2, 3, 4, 5, 6, 7, 8, 9])!, 1, "Return first element")

If the test array has more than 8 elements in it, the compilation always fails.

Could someone please check out the code on my branch and see if the issue can be replicated?

Thanks!

Xcode6 Beta4 support

Now Xcode6 Beta4 had been around for a couple of days, the notable change was the Access Control, you should update source to Beta4.

$.uniq doesn't retain order

println(",".join($.uniq(["Stockholm", "Stockholm", "SE"])))

Outputs

SE,Stockholm

It should output

Stockholm,SE

$.md5

Something like this, anybody work on that?

What is the scope of things to add?

I could see adopting a huge amount of useful functions, (like ActiveSupport does for Ruby on Rails), however I don't want to start writing these methods until I know what the scope of features you are wanting to allow.

I.E. in ruby/active_support gem there is a method to_sentence

["Cat", "Dog", "Mouse", "Banana"].to_sentence => "Cat, Dog, Mouse, and Banana"

Just one example but I wanted to find out before I start to contribute as I strongly believe in this project.

Make Dollar Library Tests Pass

With Xcode beta 4 release the tests are able to run now faster then before and are failing and need to be fixed. Some are due to language changes and some test might be failing due to genuine logic error in some methods.

Implement TODOs

Need to finish implementing some of the methods with TODO

Add more functional methods for array type to the library

Adding following methods for array types. If they are implemented ignore:

compact
difference
drop → rest
findIndex
findLastIndex
first
flatten
head → first
indexOf
initial
intersection
last
lastIndexOf
object → zipObject
pull
range
remove
rest
sortedIndex
tail → rest
take → first
union
uniq
unique → uniq
unzip → zip
without
xor
zip
zipObject

error: no such module 'Dollar' when building with xcodebuild

Builds and runs fine within Xcode, but when I try to build using xcodebuild in Terminal (needed for Facebook approval), my Swift files cannot find Dollar.

This is the command I'm running
xcodebuild -arch i386 -sdk iphonesimulator8.1

This is a representative example of the errors I'm getting:

CompileSwift normal i386 /Users/davidaragon/dev/status/Status/ViewController.swift
    cd /Users/davidaragon/dev/status
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/davidaragon/dev/status/Status/Author.swift /Users/davidaragon/dev/status/Status/AlertViewController.swift /Users/davidaragon/dev/status/Status/StatusView.swift /Users/davidaragon/dev/status/Status/NewsFeedItem.swift /Users/davidaragon/dev/status/Status/ProgressBarScoreView.swift -primary-file /Users/davidaragon/dev/status/Status/ViewController.swift /Users/davidaragon/dev/status/Status/AuthorCell.swift /Users/davidaragon/dev/status/Status/FacebookAdapter.swift /Users/davidaragon/dev/status/SwiftRegex.swift /Users/davidaragon/dev/status/Status/AppDelegate.swift /Users/davidaragon/dev/status/Status/LoadingViewController.swift /Users/davidaragon/dev/status/Status/GameViewController.swift /Users/davidaragon/dev/status/Promise.swift -target i386-apple-ios8.1 -target-cpu yonah -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -I /Users/davidaragon/dev/status/build/Release-iphonesimulator -F /Users/davidaragon/dev/status/build/Release-iphonesimulator -F /Users/davidaragon/dev/status -g -import-objc-header /Users/davidaragon/dev/status/Bridging-Header.h -Xcc -I/Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/Status-generated-files.hmap -Xcc -I/Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/Status-own-target-headers.hmap -Xcc -I/Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/Status-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/davidaragon/dev/status/build/Status.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/Status-project-headers.hmap -Xcc -I/Users/davidaragon/dev/status/build/Release-iphonesimulator/include -Xcc -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/DerivedSources/i386 -Xcc -I/Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/DerivedSources -emit-module-doc-path /Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/Objects-normal/i386/ViewController~partial.swiftdoc -O -module-name Status -emit-module-path /Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/Objects-normal/i386/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/Objects-normal/i386/ViewController.dia -emit-dependencies-path /Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/Objects-normal/i386/ViewController.d -o /Users/davidaragon/dev/status/build/Status.build/Release-iphonesimulator/Status.build/Objects-normal/i386/ViewController.o
/Users/davidaragon/dev/status/Status/FacebookAdapter.swift:10:8: error: no such module 'Dollar'
import Dollar

That last line is the crucial bit:

/Users/davidaragon/dev/status/Status/FacebookAdapter.swift:10:8: error: no such module 'Dollar'
import Dollar

The earlier build step to actually compile Dollar seems to be succeeded. It's when I try to import Dollar that xcodebuild breaks.

Fails to compile on Xcode 6 Beta 2

Line
XCTAssertNil($.find([1, 2, 3, 4], iterator: { $0 == 10 }), "Return nil when object not found")

produces
/Users/lebedzeu/src/git/Dollar.swift/DollarTests/DollarTests.swift:163:9: Could not find an overload for '==' that accepts the supplied arguments

How to add to a project

I still can't figure out how to get this to work in my project. Do I drag the .xcodeproj into my .xcworkspace? Do I drag just the folder? Or the .framework? Sorry, I'm just not to familiar with not using Cocoapods ;)

Errors when building with XCode 6 Beta 6

Building with XCode 6 Beta 6 fails with the following errors:

Dollar.swift:297:29: Cannot create a variadic tuple
Dollar.swift:297:16: '(T...)' is not a subtype of 'T'
Dollar.swift:312:47: Cannot create a variadic tuple
Dollar.swift:349:33: Cannot create a variadic tuple
Dollar.swift:873:33: Cannot create a variadic tuple

I've already started my work on a fix. Stay tuned.

Type Safety problems with $.find

Hey, this is very most likely my fault and not an issue with Dollar, but I'm trying to get $.find to work with JSON data [[String:AnyObject]]

I have a function that retrieves the data for me

func Posts() -> [[String:AnyObject]] {...}

Then, I'm trying to filter the posts based on an id:

func Post(postId:String) -> [String:AnyObject] {
    return $.find(Posts(), iterator: { $0["_id"] == postId }) as [String:AnyObject]
}

I'm stuck with this error: Type '[String:AnyObject]' does not conform to protocol 'Equatable'

add reverse

$.reverse which works on an array would be useful

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.